<?php
namespace Users\Controller;

use Think\Controller;
class ResetpwdController extends Controller{
	private $email;
	private $loginService;
	
	function _initialize(){
		$this->loginService = D('Login','Service');
		$this->email = D('Email');
		
		//cookie自动登录
		$this->loginService->cookielogin();
	}
	
	
	//找回密码
	public function index(){
		$this->display();
	}
	
	
	//邮箱找回密码
	public function emailforpwd(){
		$this->display();
	}
	
	public function editpwdforemail(){
		$map['token'] = I('get.token','0');
		$email_info = $this->email->where($map)->find();
		if($email_info){
			if(time() > $email_info['token_time']){
				die('邮件有效期已过');
			}
			$this->assign('email',$email_info['email']);
		}else{
			die('token错误');
		}
		$this->display();
	}

}